﻿using System;
using System.Data.SqlClient;

namespace Yglu.BusinessLayer.Reports
{
	public abstract class BaseReport
	{
		#region Properties

		public String Title { get; set; }
		public DateTime DateGenerated { get; set; }

		#endregion

		#region Loading

		public void Construct(SqlDataReader reader)
		{
			if (reader == null || !reader.Read())
			{
				return;
			}

			Load(reader);

			if (!reader.IsClosed)
			{
				reader.Close();
			}

			reader.Dispose();
		}

		public abstract void Load(SqlDataReader reader);

		#endregion
	}
}